package example.pattern.templatemethod;

public class StringDisplay extends AbstractDisplay {
	private final String content;
	private int length;
	
	

	public StringDisplay(String content) {
		super();
		this.content = content;
		this.length = content.length();
	}

	@Override
	protected void printOpen() {
		printLine();
	}


	@Override
	protected void printContent() {
		System.out.println("|" + content + "|");

	}

	@Override
	protected void printClose() {
		printLine();
	}
	
	private void printLine() {
		System.out.print("+");
		for(int i=0;i<length;i++){
			System.out.print("-");
		}
		System.out.println("+");
	}

}
